#pragma once

#include <ws2def.h>
#include <YSimpleSystem/YProactorToken.h>

namespace ysimple_system
{
	struct IProactor;
}

namespace ysimple_network
{
	struct IAcceptCallback;
	struct ITCPSession;

	class YProactorTokenOnAccept
		: public ysimple_system::YProactorToken
	{
		char m_addressBuffer[(sizeof(SOCKADDR_STORAGE)+16)*2];
		IAcceptCallback*	m_pCallback;
		ITCPSession*				m_pNewSession;
		ysimple_system::IProactor*	m_pProactor;
	public:
		YProactorTokenOnAccept(void);
		virtual ~YProactorTokenOnAccept(void);

		bool	onCompleted(bool completionStatus, LONG_PTR		completionKey, DWORD			dwBytesTransfered ) override;

		void	beginInit(ITCPSession& newSession, IAcceptCallback& callback, ysimple_system::IProactor& proactor);
		void	endInit(bool success);
		char*	getAddressBuffer();
		size_t getAddressBufferSize();
	};


}
